package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityDetailBinding;
import stark.common.basic.event.EventStatProxy;
import stark.common.basic.utils.UriUtil;
import stark.common.bean.StkResBean;

public class DetailActivity extends BaseAc<ActivityDetailBinding> {

    public static StkResBean bean;

    @Override
    protected int onCreate() {
        return R.layout.activity_detail;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(this, mDataBinding.event1Container);
        mDataBinding.ivDetailBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        mDataBinding.ivDetailShare.setOnClickListener(this);
        mDataBinding.webView.loadUrl(bean.getUrl());
        mDataBinding.tvDetailTitle.setText(bean.getName());
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()){
            case R.id.ivDetailShare:
                share(bean.getUrl());
                break;
        }
    }

    @Override
    protected void initData() {

    }

    private void share(String text) {
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, text);
        startActivity(Intent.createChooser(intent, "Share"));
    }

}